/* @(#)GSOrderDeptInfoModifyAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-2-17
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;

import org.apache.commons.beanutils.BeanUtils;

import com.hitrust.gs.bean.GSOrderDeptInfoBean;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrganizationProcessor;
import com.hitrust.gs.form.GSOrderDeptInfoModifyForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

/**
 * 修改订货单位的常用联系方式信息
 */
public class GSOrderDeptInfoModifyAction extends GSBaseAction{

    public String execute(GSBaseForm aForm) throws Exception {
        GSOrderDeptInfoModifyForm tForm = (GSOrderDeptInfoModifyForm)aForm;
        GSOrderDeptInfoBean tGSOrderDeptInfoBean=new GSOrderDeptInfoBean();
        //BeanUtils.copyProperties(tGSOrderDeptInfoBean,tForm);
        
        tGSOrderDeptInfoBean.setGs_deliver_goods_addr(tForm.getGoods_addr().trim());
        tGSOrderDeptInfoBean.setGs_deliver_goods_addr_id(tForm.getGoods_addr_id());
        tGSOrderDeptInfoBean.setGs_order_contact_name(tForm.getContact_name());
        tGSOrderDeptInfoBean.setGs_order_contact_phone(tForm.getContact_phone());
        tGSOrderDeptInfoBean.setGs_org_id(tForm.getGs_org_id());
        
        try{
	        GSOrderDeptInfoProcessor.modifyTask(tGSOrderDeptInfoBean);
	        aForm.getRequest().setAttribute("message", "常用联系方式修改信息修改成功!");
	        aForm.getRequest().setAttribute("requery","true"); 
	        ArrayList tAllOraganization = GSOrganizationProcessor.queryManageOrg("","");
	        aForm.getRequest().setAttribute("AllOraganization",tAllOraganization);
	       
	        //查询条件
	        aForm.getRequest().setAttribute("s_org_id",aForm.getRequest().getParameter("s_org_id"));
	        aForm.getRequest().setAttribute("s_gsdelivergoodsaddr",aForm.getRequest().getParameter("s_gsdelivergoodsaddr"));
	        
	        //得翻页信息
	        aForm.getRequest().setAttribute("s_pageNo",aForm.getRequest().getParameter("pageNo"));
	        
	        
	        return GSBaseConstants.FORWARD_SUCCESS;

        }catch(Exception e){
            e.printStackTrace();
			GSLogWriter.error(this, e.getMessage());
            aForm.getRequest().setAttribute("action", "A400801.do");
            aForm.getRequest().setAttribute("window","true");
            throw e;
        }
    }

}
